#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .log import L
import os
__author__ = 'Administrator'

BASEDIR = os.getcwd()
sysConfPath = os.path.dirname(os.path.dirname(__file__))


class Dict(dict):
    def __init__(self, names=(), values=(), **kw):
        super(Dict, self).__init__(**kw)
        for k, v in zip(names, values):
            self[k] = v

    def __getattr__(self, item):
        try:
            return self[item]
        except KeyError:
            raise AttributeError('"Dict" object has no attribute {}'.format(item))

    def __setattr__(self, key, value):
        self[key] = value


def toDict(d: dict):
    D = Dict()
    for k, v in d.items():
        D[k] = toDict(v) if isinstance(v, dict) else v
    return D


__all__ = ['L', 'BASEDIR', 'Dict', 'toDict']


